package com.cxyd.modules.wms.controller;

import com.cxyd.common.Utils.ExcelUtils;
import com.cxyd.common.annotation.LogOperation;
import com.cxyd.common.exception.ErrorCode;
import com.cxyd.common.page.PageData;
import com.cxyd.common.utils.ProcResult;
import com.cxyd.common.utils.Result;
import com.cxyd.common.validator.AssertUtils;
import com.cxyd.common.validator.ValidatorUtils;
import com.cxyd.common.validator.group.AddGroup;
import com.cxyd.common.validator.group.DefaultGroup;
import com.cxyd.common.validator.group.UpdateGroup;
import com.cxyd.modules.security.user.SecurityUser;
import com.cxyd.modules.security.user.UserDetail;
import com.cxyd.modules.wms.dto.AllotTempDTO;
import com.cxyd.modules.wms.dto.OrderDetailDTO;
import com.cxyd.modules.wms.dto.OrderReelDTO;
import com.cxyd.modules.wms.dto.StockDTO;
import com.cxyd.modules.wms.excel.OrderReelExcel;
import com.cxyd.modules.wms.excel.StockExcel;
import com.cxyd.modules.wms.service.OrderDetailService;
import com.cxyd.modules.wms.service.OrderReelService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 出库明细reelid
 *
 * @author lp
 * @since 1.0.0 2024-9-14
 */
@RestController
@RequestMapping("wms/order-reel")
public class OrderReelController {
    private final OrderReelService orderReelService;

    public OrderReelController(OrderReelService orderReelService) {
        this.orderReelService = orderReelService;
    }

    @GetMapping("page")
    //@RequiresPermissions("wms:order-detail:page")
    public Result<PageData<OrderReelDTO>> page(@RequestParam Map<String, Object> params) {
        PageData<OrderReelDTO> page = orderReelService.page(params);

        return new Result<PageData<OrderReelDTO>>().ok(page);
    }
    @GetMapping("export")
    public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
        List<OrderReelDTO> list = orderReelService.getList(params);
        ExcelUtils.exportExcelToTarget(response, null, list, OrderReelExcel.class);
    }

}